package com.yzt.minemodule.adapter;

import android.text.TextUtils;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.user.PersonEditLayoutEntry;
import com.yzt.zhuju.widget.tuiview.TUIImageView;
import com.yzt.minemodule.R;

/**
 * author : bob
 * date   : 2023/2/22
 * desc   :
 */
public class MatchProfileAdapter extends BaseQuickAdapter<PersonEditLayoutEntry, BaseViewHolder> {

    public MatchProfileAdapter() {
        super(R.layout.item_match_profile);
    }

    @Override
    protected void convert(BaseViewHolder holder, PersonEditLayoutEntry item) {

        holder.setText(R.id.title_label_tv, item.getTitle());

        TextView contentTv = holder.getView(R.id.content_tv);
        contentTv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_6d7278));

        if (TextUtils.isEmpty(item.getContent()) || "--".equals(item.getContent())) {
            contentTv.setText(getContext().getString(R.string.to_be_improved));
            contentTv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_ff4863));
        } else {
            contentTv.setText(item.getContent());
        }

//        if (item.getId() == PersonEditLayoutEntry.TYPE_BIO) {
//            //交友心声
//            if (TextUtils.isEmpty(item.getContent()) || "--".equals(item.getContent()) || getContext().getString(R.string.slogan_not_filled).equals(item.getContent()) || "此人很懒，什么都没有留下".equals(item.getContent())) {
//                contentTv.setText(getContext().getString(R.string.to_be_improved));
//                contentTv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_ff4863));
//            } else {
//                contentTv.setText(item.getContent());
//                contentTv.setTextColor(ContextCompat.getColor(getContext(), R.color.color_6d7278));
//            }
//        }

        holder.setGone(R.id.img_gender, true);

        // 性别
        if (item.getId() == PersonEditLayoutEntry.TYPE_GENDER) {
            holder.setVisible(R.id.img_gender, true);
            TUIImageView gender = holder.findView(R.id.img_gender);
            gender.setSelected(item.getContent().equals(getContext().getString(R.string.str_male)));
        }

        if (TextUtils.isEmpty(item.getContent())) {
            contentTv.setHint(item.getHint());
        }
        holder.setGone(R.id.right_icon, item.isShowNormal());
    }
}


